#include <rtthread.h>
#include <stdio.h>
#include <string.h>
#include "net_app.h"
#include "BT.h"

rt_event_t general_event = RT_NULL,net_event = RT_NULL,door_event=RT_NULL,sound_event=RT_NULL,power_event=RT_NULL,key_event=RT_NULL;

uint8_t all_event_init(){
		general_event = rt_event_create("generalE", RT_IPC_FLAG_FIFO);
    if (general_event == RT_NULL){
        rt_kprintf("general event", "event create failed\n");
        return -1;
    }
		net_event = rt_event_create("net_event", RT_IPC_FLAG_FIFO);
    if (net_event == RT_NULL){
        rt_kprintf("net event", "event create failed\n");
        return -1;
    }
		sound_event = rt_event_create("sound_event", RT_IPC_FLAG_FIFO);
    if (sound_event == RT_NULL){
        rt_kprintf("sound event", "event create failed\n");
        return -1;
    }
		door_event = rt_event_create("door_event", RT_IPC_FLAG_FIFO);
    if (door_event == RT_NULL){
        rt_kprintf("door event", "event create failed\n");
        return -1;
    }
		power_event = rt_event_create("power_event", RT_IPC_FLAG_FIFO);
    if (power_event == RT_NULL){
        rt_kprintf("power event", "event create failed\n");
        return -1;
    }
		key_event = rt_event_create("key_event", RT_IPC_FLAG_FIFO);
    if (key_event == RT_NULL){
        rt_kprintf("key event", "event create failed\n");
        return -1;
    }
}
#include "Usart_controller.h"
int main(void){
	
	all_event_init();
//	Blue_Init();
//	blue_config();
	Net_Init();

	
	for(;;){
		rt_kprintf("System run\n");
		rt_thread_delay(rt_tick_from_millisecond(8000));
	}

	return 0;
}
